using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;

namespace PluginHandler.Database
{
    public delegate void ScriptProcessedEventHandler(object sender, ScriptProcessedEventArgs e);

    public interface IDatabaseHandler
    {
        event ScriptProcessedEventHandler ScriptProcessed;

        void LoadDatabase(DbConnectionStringBuilder configuration);
        void ReloadDatabase();
        void UnloadDatabase();

        DbConnectionStringBuilder CreateConnectionStringWithPassword(DbConnectionStringBuilder connectionStringDetails, string password);

        IDatabaseStructure DatabaseStructure
        {
            get;
        }

        IDataReader ExecuteReader(string commandText);
        void ExecuteNonQuery(string commandText);
        object ExecuteScalar(string commandText);
        void ExecuteDatabaseScript(string scriptSource);

        IDbConnection DatabaseConnection
        {
            get;
        }

        DbConnectionStringBuilder ConnectionStringDetails
        {
            get;
        }

        string DelimitedIdentifierBegin { get; }
        string DelimitedIdentifierEnd { get; }
    }
}
